local skel = fk.CreateSkill {
  name = "emo__huoqi",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__huoqi"] = "获奇",
  [":emo__huoqi"] = "锁定技，每名角色每轮首次使用牌时，你获得一张基本牌。若使用牌为【杀】/【闪】，改为获得锦囊/基本牌；若使用者为你，改为获得X张（X为本轮使用过牌的角色数）。",
}

skel:addEffect(fk.CardUsing, {
  anim_type = "drawcard",
  can_trigger = function (self, event, target, player, data)
    if not player:hasSkill(skel.name) then return end
    local first = player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
      local use = e.data
      return use.from == target
    end, Player.HistoryRound)[1]
    return first and first.data == data
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local num = 1
    local t = "basic"
    if data.card.trueName == "slash" then
      t = "trick"
    elseif data.card.trueName == "jink" then
      t = "equip"
    end
    if target == player then
      local targets = {}
      player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
        table.insertIfNeed(targets, e.data.from)
      end, Player.HistoryRound)
      num = #targets
    end
    local ids = room:getCardsFromPileByRule(".|.|.|.|.|".. t, num, "allPiles")
    if #ids > 0 then
      room:obtainCard(player, ids, true, fk.ReasonJustMove, player, skel.name)
    end
  end,
})

return skel
